package com.bjesc_b2c.app.appraiset.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.bjesc_b2c.app.appraiset.R;
import com.example.codeutils.utils.TimeUtils;

import java.util.List;

import app.pinggushi.bjesc.com.baserecyclerview.adapter.CommonAdapter;
import app.pinggushi.bjesc.com.baserecyclerview.adapter.base.ViewHolder;
import master_bean.OrderTrackBean;

/**
 * Created by yidong on 2017/5/18.
 */

public class OrderTeackAdapter extends CommonAdapter<OrderTrackBean> {
    public OrderTeackAdapter(Context context, int layoutId, List<OrderTrackBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convertView(ViewHolder holder, OrderTrackBean orderTrackBean, int position) {
        if (!TextUtils.isEmpty(orderTrackBean.getImg())) {
            if (orderTrackBean.getImg().contains("http")) {
                holder.setFrescoUrl(R.id.tv_car_photo, orderTrackBean.getImg(), true);
            } else {
                holder.setFrescoFile(R.id.tv_car_photo, orderTrackBean.getImg(), true);
            }
        }
        if (!TextUtils.isEmpty(orderTrackBean.getTitle())){
                holder.setText(R.id.tv_car_title,"车型："+orderTrackBean.getTitle());
        }
        if (!TextUtils.isEmpty(orderTrackBean.getAddress())){
            holder.setText(R.id.tv_client_name,"看车地址："+orderTrackBean.getAddress());
        }
        if (!TextUtils.isEmpty(orderTrackBean.getTou_name())){
            holder.setText(R.id.tv_send_time,"预约时间："+ TimeUtils.millis2String(Long.valueOf(orderTrackBean.getAdd_time())));
        }
    }
}
